/** @format */
import React from 'react'
import classnames from 'classnames'

import './SvgIcon.scss'

type Props = {
  className?: string
  name: string
  size?: 'small' | 'medium' | 'large'
  onClick?: (e: React.MouseEvent) => void
}
const classMap = {
  small: 'sm',
  medium: 'md',
  large: 'lg'
}
function SvgIcon({ name, size = 'medium', onClick }: Props) {
  return (
    <svg
      className={classnames('icon', `icon-${classMap[size]}`)}
      aria-hidden='true'
      onClick={onClick}>
      <use xlinkHref={`#icon${name}`} />
    </svg>
  )
}
export default SvgIcon
